import java.awt.*;
import java.awt.geom.AffineTransform;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class Tortue extends Dessinable
{
	private Point p1;
	@SuppressWarnings("unused")
	public double orientation;
	private Image Iturtle;
	private boolean affiche = true ;
	private double width;
	private double height;
	
	public Tortue(Point p1, double cap,boolean affiche)
	{
		this.p1 = p1;
		this.orientation = cap;
		this.affiche = affiche;
		
		Iturtle = Logo.Itortue;
	}	
	
	//accesseur position tortue
	public int getX(){
		return p1.x;
	}
	
	public int getY(){
		return p1.y;
	}
	
	//accesseur affiche
	public boolean getAffiche(){ 
		return this.affiche; 
	}
	
	//afficher une tortue
	public void setAffiche(boolean affiche){ 
		this.affiche = affiche; 
	}
	
	
	public void dessiner(Graphics2D g)  
	{	
		if (affiche){
			dessineImage(g,orientation,(int)(p1.x),(int)(p1.y),Iturtle,0.3);
			
		}
	
	}
	
	public void dessineImage(Graphics2D g,double orientation,int x,int y, Image img,double scale)
	{
		width = img.getWidth(null) * scale;
		height = img.getHeight(null)* scale;
		g.rotate((orientation), x,y);
		g.drawImage(img,(int)(x - (width/2)),(int)(y - (height/2)),(int)width,(int)height,null);	
	}

}